package com.lsh.mq;

import com.lsh.domain.UserPraise;
import org.apache.log4j.Logger;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.jms.Destination;

/**
 * 点赞模块生产者
 * @author Administrator
 * @date 2019/10/02 22:29
 */

@Component
public class PraiseProducer {

    @Resource
    private JmsTemplate jmsTemplate;

    private Logger log = Logger.getLogger(this.getClass());

    public void sendMessage(Destination destination, final UserPraise userPraise){
        // 记录日志
        log.info("生产者>>>>>>>>>>>用户Id:" + userPraise.getUserId() + " 给评价ID: " + userPraise.getCommentId() + "点赞/取消点赞");

        jmsTemplate.convertAndSend(destination, userPraise);
    }

}
